Localizations = {
    defaultLang = 'en',

    --英文
    ["en"] = {
---========= RadioManager =========
        ['Input frequency error, set to new channel: '] = 'Input frequency error, set to new channel: ',
---========= TACANManager =========
        ['Input channel error, set to new channel: '] = 'Input channel error, set to new channel: ',

        --========= AGRange =========
        -- ['AG Range'] = 'AG Range',
    },

    --中文
    ["cn"] = {
---========= RadioManager =========
        ['Input frequency error, set to new channel: '] = '输入频率错误, 设置为新频率: ',
---========= TACANManager =========
        ['Input channel error, set to new channel: '] = '输入频道错误, 设置为新频道: ',
        
---========= AGRange =========
        ['AG Range'] = '空对地靶场',
        ['Normal range'] = '普通对地靶场',
        ['Airbase range'] = '机场目标靶场',
        ['SEAD/DEAD range'] = '反辐射训练靶场',
        ['Anti-Ship range'] = '反舰训练靶场',

        ['Refresh Targets'] = '刷新目标',
        ['Mark all [NEUTRAL] targets in range area.'] = '标记靶场内的全部[中立]目标.',
        ['Mark all [RED] targets in range area.'] = '标记靶场内的全部[红方]目标.',
        ['Mark all [BLUE] targets in range area.'] = '标记靶场内的全部[蓝方]目标.',
        ['End training'] = '结束训练',
        ['Sound: Off'] = '音效: 关',
        ['Sound: On'] = '音效: 开',

        ['Player end training manually.'] = '玩家手动结束训练.',

        ['Current User: '] = '该区域使用玩家:',
        ['No available range for this type'] = '暂无当前靶场类型可用.',
        ['Please wait %d second(s) for next mark.'] = '请等待 %d秒 后再使用标记.',

---========= Buta's_Airboss =========
        ["ERROR: Carrier unit %s is not found in mission."] = "ERROR: Carrier unit %s is not found in mission.",
        ['If the carrier TACAN not set as expected, please use: \"Reset beacons.\" in [F10 Radio] menu function.'] = '如果航母TACAN没有正确设置, 请使用[F10无线电菜单]\"重置信标.\"功能',

        --Menu
        ['Airboss'] = '航母菜单',
        ['Start CASE %d training'] = '开始CASE %d 训练',
        ['Reset beacons.'] = '重置信标.',

        ['Player [%s] starts a CASE III training, please call carrier after %dmins. Weather will last for %d hours.'] = '玩家[%s]开启了CASE III训练, 请在%d分钟后呼叫航母, 天气会持续%d小时.',
        ['Player [%s] starts a CASE I training, please call carrier after %dmins.'] = '玩家[%s]开启了CASE I训练, 请在%d分钟后呼叫航母.',
        ['Player [%s] resets all carrier beacons(Please use only when NAV equipment not set as expected).'] = '玩家[%s]重置了全部航母导航信标(请仅在导航设备未正常设置的时候使用).',

    ---========= AARTanker =========
        ['New %s tanker has spawned. Info can be found at F10 map'] = '刷新加油机 %s, 加油机信息可以在F10地图查看.',
        ['Tanker %s bingo fuel, RTB. New tanker will be spawned after it landed.'] = '加油机 %s 油量耗尽, 停止加油作业, 正在返航. 新的加油机会在这架飞机降落后刷新.',
    }
}

do

    function Localizations:translate(text, langCode)
        if not text then return end
        if not langCode or type(langCode) ~= 'string' then langCode = self.defaultLang end

        langCode = string.lower(langCode)

        local langTable = Localizations[langCode]
        local result = text

        if not langTable then 
            local defaultLangTable = Localizations[self.defaultLang]

            if defaultLangTable then
                local result = defaultLangTable[text] or text
            end
        end

        if langTable then
            result = langTable[text] or text
        end

        return result
    end


end